#define _CRT_SECURE_NO_WARNINGS 1

#include "SList.h"

void test1()
{
	SLTNode* plist = NULL;

	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);
	SLTPrint(plist);

	SLTPushFront(&plist, 5);
	SLTPrint(plist);

	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPopFront(&plist);
	SLTPrint(plist);

	SLTPopBack(&plist);
	SLTPopBack(&plist);
	SLTPrint(plist);



}

void test2()
{
	SLTNode* plist = NULL;

	SLTPushBack(&plist, 1);
	SLTPushBack(&plist, 2);
	SLTPushBack(&plist, 3);
	SLTPushBack(&plist, 4);

	SLTPrint(plist);

	SLTPushFront(&plist, 5);
	SLTPrint(plist);

	//找到值为5的元素 *2
	SLTNode* ret = SLTFind(plist, 5);
	ret->data *= 2;
	SLTPrint(plist);

	SLTInsert(&plist, ret, 50);
	SLTPrint(plist);

	//删除pos位置的节点
	SLTNode* pos = SLTFind(plist, 50);
	SLTErase(&plist, pos);
	pos = NULL;
	SLTPrint(plist);

	//在ret之后插入节点
	SLTInsertAfter(&plist, ret, 60);
	SLTPrint(plist);

	//删除ret之后的节点
	SLTEraseAfter(&plist, ret);
	SLTPrint(plist);





}

int main()
{

	test1();
	//test2();

	return 0;
}